from lib.base import Base
class AddColumn(Base):

    def __init__(self, db, query):
        self._clear_attributes()
        self.db = db
        self.query = self._determine_attributes(query)

    def execute(self):
        print "Running add column to: %s, column: %s" % (self.table, self.column_name)
        self.db.execute(self.query)
        return True
    
    def _determine_attributes(self, query):
        query = self._trim_table(query)
        query = self._trim_column_name(query)
        self._build_dictionary(query)
        return self.db.format_add_column(self.table, self.column_name, self.attributes)
